<?php

namespace App\Http\Controllers\Administrator\Game;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class FileController extends Controller
{
    public function download($fileName)
    {
        $file = storage_path('app/download/' . $fileName);
        $name = basename($file);
        if (file_exists($file)) {
            return response()->download($file, $name, $headers = ['Content-Type' => 'application/zip;charset=utf-8']);
        } else {
            return redirect()->back()->withInput()->with('danger', '文件不存在');
        }
    }
}
